#include "PointLightSource.h"

namespace lib3dw
{
	LightType PointLightSource::GetLightType()
	{
		return PointLight;
	}
	
	void PointLightSource::SetupLightMatrices() const
	{
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();
		glLoadIdentity();
		float near = position[1] <= 0.0 ? 1.0 : position[1];
		gluPerspective(90.0f, 1.0f, near, 20.0f);
		glGetFloatv(GL_MODELVIEW_MATRIX, lightProjMat);

		glLoadIdentity();
		gluLookAt(position[0], position[1], position[2],
			12.0f, -2.0f, 12.0f,
			0.0f, 0.0f, 1.0f);
		glGetFloatv(GL_MODELVIEW_MATRIX, lightViewMat);
		glPopMatrix();
	}
	
	int PointLightSource::GetShadowMapSize()
	{
		return pointLightShadowMapSize;
	}
}